home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK1.toast / Development Kits (Disc 1) / AppleShare API / ServerEvent / ServerEventIntf.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-04-12  |  7.1 KB  |  133 lines  |  [TEXT/MPS ]

  1. /************************************************************
  2.  
  3. Created: Monday, April 27, 1992 at 2:50 PM
  4.     ServerEventIntf.h
  5.     C Interface to the Macintosh Libraries
  6.  
  7.  
  8.         Copyright Apple Computer, Inc. 1990-1992
  9.         All rights reserved
  10.     
  11.     4/10/95        JML        Added alignment pragmas
  12.  
  13. ************************************************************/
  14.  
  15. #ifndef __APPLETALK__
  16. #include <AppleTalk.h>
  17. #endif
  18.  
  19. #if GENERATINGPOWERPC
  20. #pragma options align=mac68k
  21. #endif
  22.  
  23. /* Constants used in the tSEQEntry */
  24.  
  25. /* The SEeventFlag bits in tSEQEntry specify when the server event handler would like to be called */
  26. /* SEeventFlag bits */
  27. enum {
  28.     bCSEHAFPInDoRequest = 0,    /* An AFP call is starting up (in DoRequest, about to be dispatched) */
  29.     bCSEHAFPInSendResponse = 1,    /* An AFP call has completed (in SendResponse, about to send out the response) */
  30.     bCSEHServerBusy = 2,        /* A new session is being denied because the server is busy (socket starvation event) */
  31.     bCSEHServerShutdown = 3,    /* The server just shut down */
  32.     bCSEHServerControlCall = 4,    /* A server control call has just completed */
  33.                                 /* NOTE: The following server control calls do not cause a bCSEHServerControlCall server event: */
  34.                                 /* SCStartServer, SCInstallServerEventProc, SCRemoveServerEventProc, SCGetServerEventProc, SCServerVersion, and SCWakeServer. */
  35.                                 /* You can use the bCSEHServerStartup server event to detect server starts and wakeups. */
  36.     bCSEHShare = 5,                /* An HFS Share trap has just completed */
  37.     bCSEHUnShare = 6,            /* An HFS UnShare trap has just completed */
  38.     bCSEHSetDirAccess = 7,        /* An HFS SetDirAccess trap has just completed */
  39.     bCSEHServerNameChange = 8,    /* An attempt was made to change the server name (the attempt may or may not have been successful) */
  40.     bCSEHVolumePrep = 9,        /* A new volume was just prepared for use with AppleShare */
  41.     bCSEHVolumeUnmount = 10,    /* A volume unmount was attempted on an AppleShare volume */
  42.     bCSEHServerStartup = 11,    /* The server just successfully started up */
  43.     bCSEHSessionTornDown = 12,    /* A user's session was torn down because any one of a number of reasons, including a */
  44.                                 /* disconnect, server shutdown, timeout, or workstation initiated close session */
  45.     bCSEHOutOfSequence = 13,    /* A packet was received out of sequence; the session may be a zombie */
  46.     bCSEHWksClosedSession = 14,    /* A workstation closed its ASP session (i.e., it logged out) */
  47.     bCSEHSessionTimedOut = 15,    /* A workstation's session timed out */
  48.     bCSEHSrvrClosedSession = 16    /* The server has closed a workstation's session */
  49. };
  50.  
  51. /* When SEeventFlag bits bCSEHAFPInDoRequest or bCSEHAFPInSendResponse are set, the bits in SEwhichAFPFlag */
  52. /* determine which AFP calls will cause the server event handler to be called. */
  53. /* SEwhichAFPFlag bits */
  54. /*    bit 0  of SEwhichAFPFlag[1] - call SE handler when AFPCommand = 192 (afpAddIcon) */
  55. /*    bit 1  of SEwhichAFPFlag[1] - call SE handler when AFPCommand = 1    */
  56. /*    bit 2  of SEwhichAFPFlag[1] - call SE handler when AFPCommand = 2    */
  57. /*    ...                                                                    */
  58. /*    bit 31 of SEwhichAFPFlag[1] - call SE handler when AFPCommand = 31    */
  59. /*    bit 0  of SEwhichAFPFlag[0] - call SE handler when AFPCommand = 32    */
  60. /*    ...                                                                    */
  61. /*    bit 63 of SEwhichAFPFlag[0] - call SE handler when AFPCommand = 63    */
  62.  
  63.  
  64. /* When SEeventFlag bit bCSEHServerControlCall is set, the bits in SEwhichSCFlag determine */
  65. /* which server control calls will cause the server event handler to be called. */
  66. /* SEwhichSCFlag bits */
  67. /*    bit 0  of SEwhichSCFlag - call SE handler when scCode = 0 (SCStartServer)    */
  68. /*    ...                                                            */
  69. /*    bit 31 of SEwhichSCFlag - call SE handler when scCode = 31    */
  70.  
  71.  
  72. #define BufferMax                48    /* maximum size of the Buffer in the ServerEventRecord */
  73.  
  74. struct ServerEventRecord {
  75.     long        theEventNumber;        /* the server event that's occuring; see the SEeventFlag definitions above */
  76.     long        theServerTime;        /* the server time (in Macintosh DateTime form) */
  77.     OSErr        theResult;            /* the result of the operation */
  78.                     /* if theEventNumber = bCSEHAFPInSendResponse: the AFP Error code to be returned */
  79.                     /* if theEventNumber = bCSEHServerControlCall: the result of the server control call */
  80.                     /* if theEventNumber = bCSEHShare, bCSEHUnShare, or bCSEHSetDirAccess: the result of the HFS call */
  81.                     /* if theEventNumber = bCSEHServerNameChange: the result of a PRegisterName call, SECantRegNameErr, or SEDupNameErr */
  82.                     /* if theEventNumber = bCSEHVolumeUnmount: noErr or fBsyErr (if volume is being used by a remote user) */
  83.                     /* all other values of theEventNumber return noErr */
  84.     short        theBufSize;            /* the number of bytes used in theBuffer */
  85.     Byte        theBuffer[BufferMax];
  86.                     /* if theEventNumber = bCSEHAFPInDoRequest or bCSEHAFPInSendResponse: the first BufferMax bytes of the AFP packet */
  87.                     /* if theEventNumber = bCSEHServerControlCall: the first BufferMax bytes of the SCParamBlockRec */
  88.                     /* if theEventNumber = bCSEHShare, bCSEHUnShare, bCSEHSetDirAccess, bCSEHVolumePrep, or bCSEHVolumeUnmount: */
  89.                     /*                     the first BufferMax bytes of the HParamBlockRec */
  90.                     /* if theEventNumber = bCSEHServerNameChange: the new server name (in a Pascal string) */
  91.                     /* all other values of theEventNumber return a zero length buffer */
  92.     Str31        theNameStr;            /* the name of the file, if any; not always defined */
  93.     short        theAFPCommand;        /* if theEventNumber = bCSEHAFPInDoRequest or bCSEHAFPInSendResponse, the AFP call number */
  94.  
  95.     /* Note: If theEventNumber is bCSEHAFPInDoRequest, bCSEHAFPInSendResponse, bCSEHSessionTornDown, bCSEHOutOfSequence, */
  96.     /* bCSEHWksClosedSession, bCSEHSessionTimedOut, or bCSEHSrvrClosedSession, then theUNRecID, theUNSUserID, */
  97.     /* theUserName, and theSocketAddress of the user that made the call are returned. */
  98.                 
  99.     long        theUNRecID;            /* the UNRecID of the user that made the call */
  100.     long        theUNSUserID;        /* the UserID of the user that made the call */
  101.     Str31        theUserName;        /* the name of the user that made the call */
  102.  
  103.     /* Note: If theEventNumber is bCSEHAFPInDoRequest or bCSEHAFPInSendResponse, then theVRefNum and theDirID will be */
  104.     /* returned if applicable to the AFP call */
  105.         
  106.     short        theVRefNum;            /* the VRefNum of the volume upon which this operation was performed (not always applicable) */
  107.     long        theDirID;            /* the DirID of the directory upon/within which this operation was performed (not always applicable) */
  108.     AddrBlock    theSocketAddress;    /* the network address of the user's workstation in AddrBlock format */
  109. };
  110.  
  111. #ifndef __cplusplus
  112. typedef struct ServerEventRecord ServerEventRecord;
  113. #endif    // __cplusplus
  114.  
  115. typedef ServerEventRecord *ServerEventRecordPtr;
  116.  
  117. struct tSEQEntry {
  118.     ATQEntry    SEQentry;            /* a regular AppleTalk Transition Queue entry */
  119.     long        SEeventFlag;        /* specifies when the Server Event Handler would like to be called */
  120.     long        SEwhichAFPFlag[2];    /* specifies which AFP calls will cause the Server Event Handler to be called */
  121.     long        SEwhichSCFlag;        /* specifies which Server Control calls will cause the Server Event Handler to be called */
  122. };
  123.  
  124. #ifndef __cplusplus
  125. typedef struct tSEQEntry tSEQEntry;
  126. #endif    // __cplusplus
  127.  
  128. typedef tSEQEntry *tSEQEntryPtr;
  129.  
  130. #if GENERATINGPOWERPC
  131. #pragma options align=reset
  132. #endif
  133.